home *** CD-ROM | disk | FTP | other *** search
- Path: sun001.spd.dsccc.com!spd!jmccarty
- From: jmccarty@spd.dsccc.com (Mike McCarty)
- Newsgroups: comp.lang.c
- Subject: Re: Where Can I Find Standard C Library S
- Date: 9 Feb 1996 00:33:13 GMT
- Organization: DSC Communications Corporation, Plano, Texas USA
- Message-ID: <4fe4o9$h9d@sun001.spd.dsccc.com>
- References: <4fb8mf$ouo@spanky.pls.ov.com> <4fb90l$ouo@spanky.pls.ov.com> <3119E6D9.60FD@cmt.lpr.mail.carel.fi>
- NNTP-Posting-Host: aplo139.spd.dsccc.com
-
- In article <3119E6D9.60FD@cmt.lpr.mail.carel.fi>,
- Ari Lukumies <aril@cmt.lpr.mail.carel.fi> wrote:
- )Fletcher.Glenn@ov.com wrote:
- )>
- )>
- )> Whoops! for strcpy:
- )>
- )> char *strcpy(char *destination, char *source)
- )> {
- )> char *retval;
- )>
- )> retval = destination;
- )> while((*destination++ = *source++) != '\0');
- )> return(retval);
- )> }
- )> Fletcher.Glenn@ov.com
- )
- )... And you wonder why printf("%s\n", strcpy(tmp, "thingyam")); may not give correct
- )results using your strcpy version... Try this for size:
-
- [alternate strcpy() (also not ANSI comformant) deleted]
-
- )This will also copy the nul-terminator. :)
-
- So does Ari's code.
-
- Mike
- ----
- char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
-
- I don't speak for DSC. <- They make me say that.
-